package cn.woblog.recyclerviewsample;

import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.RecyclerView;
import android.support.v7.widget.StaggeredGridLayoutManager;
import android.widget.LinearLayout;
import cn.woblog.recyclerviewsample.divider.GridItemDecoration;
import java.util.ArrayList;

public class GridDivider2Activity extends AppCompatActivity {

  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_grid_divider2);

    RecyclerView rv = (RecyclerView) findViewById(R.id.rv);
//    rv.setLayoutManager(new GridLayoutManager(this, 3));
    rv.setLayoutManager(new StaggeredGridLayoutManager(3, LinearLayout.VERTICAL));
//    rv.addItemDecoration(new CustomGridItemDecoration(this));
    rv.addItemDecoration(new GridItemDecoration(this));
//    rv.addItemDecoration(new DividerGridItemDecoration(this));

    UseCustomGridAdapter useCustomAdapter = new UseCustomGridAdapter(this);
    rv.setAdapter(useCustomAdapter);

    ArrayList<String> data = new ArrayList<>();
    for (int i = 0; i < 50; i++) {
      data.add("Item " + i);
    }

    useCustomAdapter.setData(data);
  }
}
